package com.zmn.oms.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * 上门录音节点枚举
 *
 * @author chengguang
 * @date 2022/07/20
 */
@AllArgsConstructor
@Getter
public enum WorkingRecordNodeEnum {

    /**
     * values
     */
    COME_DOOR(1, "上门"),
    START_QUOTATION(2, "开始报价"),
    CONFIRM_REPORT(3, "确认检测报告"),
    DISCOUNTS_ACTIVITIES(4, "优惠活动"),
    APPLY_DISCOUNTS(5, "申请优惠"),
    SERVICE_COMPLETION(6, "服务完成"),
    WAITING_PAYMENT(7, "等待付款"),
    START_MAINTENANCE(8, "开始维修"),
    SELECT_SERVICE_ITEM(9, "选择服务项目");

    private final Integer code;
    private final String nodeName;

    public static String getNodeName(Integer code) {
        WorkingRecordNodeEnum workingRecordNodeEnum = Arrays.stream(WorkingRecordNodeEnum.values())
                .filter(nodeEnum -> nodeEnum.getCode().equals(code))
                .findFirst().orElse(null);
        return Objects.nonNull(workingRecordNodeEnum) ? workingRecordNodeEnum.getNodeName() : null;
    }
}
